<template>
  <div class="continue">
    <div class="left-panel">
      <div class="search-wrapper">
        <div class="input-wrapper">
          <i class="iconfont chat-search"></i>
          <input placeholder="搜索"/>
        </div>
      </div>
      <div class="collect-list">
        <template v-for="(item,key) in menus">
          <div class="item" :class="menuActive === key ?'active':''" @click="switchMenu(key)">
            <i class="iconfont" :class="[item.icon]"></i>
            <div class="text">{{ item.name }}</div>
          </div>
        </template>
      </div>
    </div>
    <div class="right-panel">
      <div class="head-wrapper">
        <div class="nickname">干干</div>
        <div class="tools">
          <div class="menu-list">
            <i class="iconfont chat-pushpin"></i>
            <i class="iconfont chat-minus"></i>
            <i class="iconfont chat-border"></i>
            <i class="iconfont chat-close"></i>
          </div>
        </div>
      </div>
      <div class="collect-content-wrapper">
        <div class="item item-text">
          <div class="content">
            2025年最危险的诈骗套路：伪装成“抖音会议”“银联会议”的软件正通过屏幕共享和远程操控技术“秒偷”存款。一旦安装，手机即沦为“透明盒子”——密码、人脸识别、转账全被操控，全国一周内已有超200人中招。
          </div>
          <div class="footer">
            <div class="name">名称</div>
            <div class="date">2024年1月10日</div>
          </div>
        </div>
        <div class="item">
          <div class="file-wrapper">
            <div class="file-info">
              <div class="name">文件名称文件名称文件名称文件名称文件名称文件名称</div>
              <div class="size">PDF 981.0kPDF 981.0kPDF 981.0kPDF 981.0kPDF 981.0k</div>
            </div>
            <div class="svg">
              <img src="@/assets/fileSvg/pdf.svg">
            </div>
          </div>
          <div class="footer">
            <div class="name">名称</div>
            <div class="date">2024年1月10日</div>
          </div>
        </div>
        <div class="item">
          <div class="img-wrapper">
            <img src="@/assets/images/avatar.jpg">
          </div>
          <div class="footer">
            <div class="name">名称</div>
            <div class="date">2024年1月10日</div>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script setup lang="ts">
import {useMenus} from '@/hooks/collecthooks/menus.ts';

//添加好友状态
let {menus, menuActive, switchMenu} = useMenus();
</script>


<style scoped lang="scss">

.continue {
  display: flex;
  width: 100%;
  height: 100%;
}

.left-panel {
  width: 240px;
  background: #eee;
  display: flex;
  flex-direction: column;
  border-right: 1px solid #ccc;

  .search-wrapper {
    padding: 18px 8px 8px;
    background: #ddd;
    display: flex;

    .iconfont {
      font-size: 16px;
    }

    .input-wrapper {
      display: flex;
      flex: 1;
      align-items: center;
      height: 24px;
      padding: 0 4px;
      border-radius: 4px;

      input {
        border: none;
        outline: none;
      }

      background: #fff;
    }

    .add-wrapper {
      background: #fff;
      width: 24px;
      height: 24px;
      border-radius: 4px;
      display: flex;
      justify-content: center;
      align-items: center;
    }
  }

  .collect-list {
    display: flex;
    flex: 1;
    flex-direction: column;

    .item {
      display: flex;
      padding: 8px 8px 8px 16px;
      width: 100%;
      cursor: pointer;
      font-size: 14px;
      line-height: 24px;

      .iconfont {
        font-size: 22px;
        margin-right: 4px;
      }
    }

    .item:hover {
      background: #e1e1e1;
    }

    .active {
      background: #ccc;
    }
  }
}

.right-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: #eee;

  .head-wrapper {
    height: 50px;
    background: #ddd;
    padding: 0 4px 0 20px;
    display: flex;
    justify-content: space-between;

    .nickname {
      font-size: 20px;
      line-height: 50px;
    }

    .tools {
      display: flex;
      flex-direction: column;
      padding: 4px;

      .menu-list {
        display: flex;
        column-gap: 8px;

        .iconfont {
          font-size: 12px;
          cursor: pointer;
        }
      }
    }
  }

  .collect-content-wrapper {
    flex: 1;
    padding: 16px;
    gap: 8px;
    display: flex;
    flex-direction: column;
    align-items: center;

    .item {
      width: 80%;
      background: #fff;
      border-radius: 8px;
      padding: 16px;

      .content {
        display: -webkit-box;
        -webkit-line-clamp: 2; /* 限制行数 */
        -webkit-box-orient: vertical;
        overflow: hidden;
        font-size: 14px;
        line-height: 20px;
        height: 40px;
      }

      .file-wrapper {
        display: flex;

        .file-info {
          flex: 1;
          display: flex;
          flex-direction: column;
          overflow: hidden;

          .name {
            font-size: 14px;
            line-height: 20px;
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
          }

          .size {
            color: #999;
            font-size: 12px;
            line-height: 20px;
            margin-top: 4px;
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
          }
        }

        .svg {
          width: 50px;
          margin-left: 16px;

          img {
            width: 100%;
            display: block;
          }
        }
      }

      .img-wrapper {
        height: 100px;

        img {
          max-height: 100%;
        }
      }

      .footer {
        margin-top: 16px;
        display: flex;
        justify-content: space-between;
        color: #999;
        font-size: 12px;
      }
    }

  }
}
</style>